FROM ubuntu:latest

WORKDIR /PrintlesCalculator

COPY . .

RUN \
# 修改apt至清华源
    sed -i s@/archive.ubuntu.com/@/mirrors.tuna.tsinghua.edu.cn/@g /etc/apt/sources.list \
&&  sed -i s@/security.ubuntu.com/@/mirrors.tuna.tsinghua.edu.cn/@g /etc/apt/sources.list \
&&  apt clean \
&&  apt update && apt upgrade -y \
# 安装python环境
&&  apt install python3.10 python3.10-distutils -y \
&&  apt install wget -y && wget https://bootstrap.pypa.io/get-pip.py \
&&  python3.10 get-pip.py \
&&  python3.10 -m pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple \
# 添加字体
&&  mkdir ~/.fonts && mv ./fonts/*.ttf ~/.fonts/ \
&&  apt install fontconfig -y && fc-cache -vf \
&&  apt install language-pack-zh-hant language-pack-zh-hans -y \
# 下载libreoffice
&&  apt install libreoffice poppler-utils -y 

CMD [ "gunicorn", "src.main:app", "--config", "/PrintlesCalculator/config/gunicorn_conf.py" ]